#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<list>

using namespace std;

#include"list.h"

void test_list1()
{
	list<int> ls;
	ls.push_back(1);
	ls.push_back(2);
	ls.push_back(3);

	list<int>::iterator it = ls.begin();
	while (it != ls.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;

	for (auto i: ls)
	{
		cout << i << " ";
	}
	cout << endl;

	ls.push_back(7);
	ls.push_back(1);
	ls.push_back(5);

	for (auto i : ls)
	{
		cout << i << " ";
	}
	cout << endl;

	ls.sort();

	for (auto i : ls)
	{
		cout << i << " ";
	}
	cout << endl;
}

void test_list2()
{
	list<int> lt1;
	lt1.push_back(1);
	lt1.push_back(2);
	lt1.push_back(3);
	lt1.push_back(4);

	for (auto i : lt1)
	{
		cout << i << " ";
	}
	cout << endl;

	list<int> lt2;
	lt2.push_back(10);
	lt2.push_back(20);
	lt2.push_back(30);
	lt2.push_back(40);

	for (auto i : lt2)
	{
		cout << i << " ";
	}
	cout << endl;


	list<int>::iterator it = lt1.begin();
	lt1.splice(++it, lt2,lt2.begin(),lt2.end());

	for (auto i : lt1)
	{
		cout << i << " ";
	}
	cout << endl;
	for (auto i : lt2)
	{
		cout << i << " ";
	}
	cout << endl;

}

int s = 0;

const int* test()
{
	const int* p = &s;

	//*p = 10;
	s = 10;
	return &s;
}
int main()
{
	//test_list2();

	//yj::test_mylist3();
	const int*p=test();
	int s1 = 10;
	p = &s1;

	yj::test_mylist4();
	return 0;
}